<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <style>
        body {
            height: 2000px;
        }

        .gun {
            position: fixed;
            right: 20px;
            bottom: 40px;
            width: 50px;
            height: 50px;
            background-color: #dd3535;
            border-radius: 50%;
            font-size: 12px;
            text-align: center;
            line-height: 50px;

        }
    </style>
</head>

<body>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div>12212323211</div>
    <div class="gun">
        点击
    </div>
</body>

</html>
<script>
    $('.gun').click(function () {
       
        // window.scrollTo(0,0);
        // document.documentElement.clientHeight = document.documentElement.clientHeight - 100;
        document.documentElement.scrollBy({ top: -100, behavior: 'smooth' })
        // this.scrollBy({ top: -100, behavior: 'smooth' })
    })
</script>